package highlevel.clock;

import java.awt.Graphics;
import java.util.Calendar;
import java.util.GregorianCalendar;

import javax.swing.JPanel;

public class DrawClock extends JPanel{

	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		//��Բ
		g.drawOval(60, 40, 240, 240);
		
		//����
		Calendar calendar = new GregorianCalendar();
//		Calendar calendar = Calendar.getInstance();
		int second = calendar.get(Calendar.SECOND);
		int minute = calendar.get(Calendar.MINUTE);
		int hour = calendar.get(Calendar.HOUR);
		System.out.println(second);
		//����
		int a = 180+(int)(100*Math.sin(Math.PI*second/30));
		int b =  160+(int)(100*Math.cos(Math.PI*second/30));
		g.drawLine(180, 160, a , b);
	}
	
}
